Visual Basic (Declaration) | |
---|---|
Public Shared Function WithDuplicateHandling( _ ByVal items As IEnumerable(Of T), _ ByVal comparer As IComparer(Of T), _ ByVal duplicateHandling As DuplicateHandling _ ) As IEnumerable(Of T) |
C# | |
---|---|
public static IEnumerable<T> WithDuplicateHandling( IEnumerable<T> items, IComparer<T> comparer, DuplicateHandling duplicateHandling ) |
Parameters
- items
- comparer
- duplicateHandling
Library/Library.Test/TestOrderedEnumeration.cs
C# | Copy Code |
---|---|
char[] x = "aeiou".ToCharArray(); char[] y = "bcdfg".ToCharArray(); char[] z = "ez".ToCharArray(); var order = OrderedEnumeration<char>.Merge(x, y, z); Assert.AreEqual("abcdeefgiouz", new string(new List<char>(order).ToArray())); order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, DuplicateHandling.LastValueWins, x, y, z); Assert.AreEqual("abcdefgiouz", new string(new List<char>(order).ToArray())); order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, x, y); order = OrderedEnumeration<char>.WithDuplicateHandling(order, Comparer<char>.Default, DuplicateHandling.FirstValueWins); Assert.AreEqual("abcdefgiou", new string(new List<char>(order).ToArray())); |
VB.NET | Copy Code |
---|---|
Dim x As Char() = "aeiou".ToCharArray() Dim y As Char() = "bcdfg".ToCharArray() Dim z As Char() = "ez".ToCharArray() Dim order As var = OrderedEnumeration(Of Char).Merge(x, y, z) Assert.AreEqual("abcdeefgiouz", New String(New List(Of Char)(order).ToArray())) order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], DuplicateHandling.LastValueWins, x, y, z) Assert.AreEqual("abcdefgiouz", New String(New List(Of Char)(order).ToArray())) order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], x, y) order = OrderedEnumeration(Of Char).WithDuplicateHandling(order, Comparer(Of Char).[Default], DuplicateHandling.FirstValueWins) Assert.AreEqual("abcdefgiou", New String(New List(Of Char)(order).ToArray())) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
OrderedEnumeration<T> ClassOrderedEnumeration<T> Members
DuplicateHandling
Used By
Int32 BPlusTreeIEnumerable
IEnumerable